package com.change.declare.crm.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.change.declare.crm.entity.ClientconsigneesEntity;
import com.change.declare.crm.service.ClientconsigneesService;
import com.change.common.utils.PageUtils;
import com.change.common.utils.R;



/**
 * 
 *
 * @author LK
 * @email hmscrdlk@gmail.com
 * @date 2020-07-05 16:04:18
 */
@RestController
@RequestMapping("crm/clientconsignees")
public class ClientconsigneesController {
    @Autowired
    private ClientconsigneesService clientconsigneesService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("crm:clientconsignees:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = clientconsigneesService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("crm:clientconsignees:info")
    public R info(@PathVariable("id") Long id){
		ClientconsigneesEntity clientconsignees = clientconsigneesService.getById(id);

        return R.ok().put("clientconsignees", clientconsignees);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("crm:clientconsignees:save")
    public R save(@RequestBody ClientconsigneesEntity clientconsignees){
		clientconsigneesService.save(clientconsignees);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("crm:clientconsignees:update")
    public R update(@RequestBody ClientconsigneesEntity clientconsignees){
		clientconsigneesService.updateById(clientconsignees);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("crm:clientconsignees:delete")
    public R delete(@RequestBody Long[] ids){
		clientconsigneesService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
